$OpenBSD: patch-unix_uxnoise_c,v 1.3 2013/01/13 10:12:52 brad Exp $
--- unix/uxnoise.c.orig	Wed Sep 16 18:28:20 2009
+++ unix/uxnoise.c	Thu Dec 27 01:32:29 2012
@@ -49,38 +49,11 @@ static int read_dev_urandom(char *buf, int len)
 
 void noise_get_heavy(void (*func) (void *, int))
 {
-    char buf[512];
-    FILE *fp;
-    int ret;
-    int got_dev_urandom = 0;
+    char buf[32];
 
-    if (read_dev_urandom(buf, 32)) {
-	got_dev_urandom = 1;
-	func(buf, 32);
-    }
+    if (read_dev_urandom(buf, sizeof(buf)))
+	func(buf, sizeof(buf));
 
-    fp = popen("ps -axu 2>/dev/null", "r");
-    if (fp) {
-	while ( (ret = fread(buf, 1, sizeof(buf), fp)) > 0)
-	    func(buf, ret);
-	pclose(fp);
-    } else if (!got_dev_urandom) {
-	fprintf(stderr, "popen: %s\n"
-		"Unable to access fallback entropy source\n", strerror(errno));
-	exit(1);
-    }
-
-    fp = popen("ls -al /tmp 2>/dev/null", "r");
-    if (fp) {
-	while ( (ret = fread(buf, 1, sizeof(buf), fp)) > 0)
-	    func(buf, ret);
-	pclose(fp);
-    } else if (!got_dev_urandom) {
-	fprintf(stderr, "popen: %s\n"
-		"Unable to access fallback entropy source\n", strerror(errno));
-	exit(1);
-    }
-
     read_random_seed(func);
     random_save_seed();
 }
@@ -114,21 +87,13 @@ void noise_get_light(void (*func) (void *, int))
  */
 void noise_regular(void)
 {
-    int fd;
-    int ret;
-    char buf[512];
+    u_int32_t buf[8], i;
     struct rusage rusage;
 
-    if ((fd = open("/proc/meminfo", O_RDONLY)) >= 0) {
-	while ( (ret = read(fd, buf, sizeof(buf))) > 0)
-	    random_add_noise(buf, ret);
-	close(fd);
-    }
-    if ((fd = open("/proc/stat", O_RDONLY)) >= 0) {
-	while ( (ret = read(fd, buf, sizeof(buf))) > 0)
-	    random_add_noise(buf, ret);
-	close(fd);
-    }
+    for (i = 0; i < 8; i++)
+        buf[i] = arc4random();
+    random_add_noise(buf, sizeof(buf));
+
     getrusage(RUSAGE_SELF, &rusage);
     random_add_noise(&rusage, sizeof(rusage));
 }
@@ -141,6 +106,9 @@ void noise_regular(void)
 void noise_ultralight(unsigned long data)
 {
     struct timeval tv;
+    u_int32_t r;
+    r = arc4random();
+    random_add_noise(&r, sizeof(r));
     gettimeofday(&tv, NULL);
     random_add_noise(&tv, sizeof(tv));
     random_add_noise(&data, sizeof(data));
